#ifndef _SPRITE_DEF_H_
#define _SPRITE_DEF_H_

#define	FIXED_PRECISION					8

#define TEMP_BUFFER_SIZE  				100 * 1024  
//#define USE_MODULE_MAPPINGS		 		false 
#define USE_HYPER_FM					true  
#define USE_INDEX_EX_FMODULES		 	true  
#define USE_INDEX_EX_AFRAMES
#define USE_PRECOMPUTED_FRAME_RECT
//#define ALWAYS_BS_NFM_1_BYTE		 		false  
//#define ALWAYS_BS_SKIP_FRAME_RC	 		false  
//#define ALWAYS_BS_FRAME_COLL_RC			 false  
//#define ALWAYS_BS_NAF_1_BYTE				 false  
#define USE_PIXEL_FORMAT_8888		 	true
#define USE_PIXEL_FORMAT_4444		 	true
#define USE_PIXEL_FORMAT_1555		 	true
#define USE_PIXEL_FORMAT_0565		 	true
#define USE_ENCODE_FORMAT_I2		 	true
#define USE_ENCODE_FORMAT_I4		 	true
#define USE_ENCODE_FORMAT_I16		 	true
#define USE_ENCODE_FORMAT_I256		 	true
#define USE_ENCODE_FORMAT_I64RLE	 	true
#define USE_ENCODE_FORMAT_I127RLE	 	true
#define USE_ENCODE_FORMAT_I256RLE	 	true

#define MAX_SPRITE_PALETTES			 	16
#define MAX_MODULE_MAPPINGS			 	16
#define MAX_ANIMATION_INSTANCES		 	40
#define BSPRITE_v003	 				(short)0x03DF      
#define BS_MODULES			 			(1 << 0)
#define BS_MODULES_XY		 			(1 << 1)
#define BS_MODULES_IMG		 			(1 << 2)
#define BS_FRAMES			 			(1 << 8)
#define BS_FM_OFF_SHORT	 				(1 << 10)     
#define BS_NFM_1_BYTE		 			(1 << 11)     
#define BS_SKIP_FRAME_RC	 			(1 << 12)     
#define BS_FRAME_COLL_RC    			(1 << 13)     
#define BS_ANIMS			 			(1 << 16)
#define BS_AF_OFF_SHORT	 				(1 << 18)    
#define BS_NAF_1_BYTE		 			(1 << 19)     
#define BS_MODULE_IMAGES	 			(1 << 24)
#define BS_PNG_CRC			 			(1 << 25)
#define BS_KEEP_PAL		 				(1 << 26)
#define BS_TRANSP_FIRST	 				(1 << 27)
#define BS_TRANSP_LAST		 			(1 << 28)
#define BS_DEFAULT_DOJA	 				(BS_MODULES | BS_FRAMES | BS_ANIMS)
#define BS_DEFAULT_MIDP2	 			(BS_MODULES | BS_FRAMES | BS_ANIMS | BS_MODULE_IMAGES)
#define BS_DEFAULT_NOKIA	 			BS_DEFAULT_MIDP2
#define BS_DEFAULT_MIDP1	 			(BS_MODULES | BS_MODULES_XY | BS_FRAMES | BS_ANIMS)
#define BS_DEFAULT_MIDP1b	 			(BS_MODULES | BS_FRAMES | BS_ANIMS | BS_MODULE_IMAGES | BS_PNG_CRC)

#define PIXEL_FORMAT_8888		 		(short)0x8888
#define PIXEL_FORMAT_4444		 		(short)0x4444
#define PIXEL_FORMAT_1555		 		(short)0x5515
#define PIXEL_FORMAT_0565		 		(short)0x6505  
#define ENCODE_FORMAT_I2			 	0x0200
#define ENCODE_FORMAT_I4			 	0x0400   
#define ENCODE_FORMAT_I16		 		0x1600        
#define ENCODE_FORMAT_I256				0x5602    
#define ENCODE_FORMAT_I64RLE		 	0x64F0
#define ENCODE_FORMAT_I127RLE	 		0x27F1
#define ENCODE_FORMAT_I256RLE	 		0x56F2

#define  FLAG_FLIP_X	 				0x01
#define  FLAG_FLIP_Y	 				0x02
#define  FLAG_ROT_90	 				0x04
#define  FLAG_USER0	 					0x10  
#define  FLAG_USER1	 					0x20  
#define  FLAG_HYPER_FM	 				0x10       
#define FLAG_INDEX_EX_MASK  			0xC0  
#define INDEX_MASK						0x03FF  
#define INDEX_EX_MASK		 			0x0300
#define INDEX_EX_SHIFT 	 				2
#define  FLAG_OFFSET_FM  				0x10
#define CBGSound   						HWND
#define  FLAG_OFFSET_AF  				0x20   
#define STACK_SIZE  					200 
#define SCROLL_DELAY_TIME  				40 

#define T_PAL							u8

#ifndef ARRC
#define ARRC
#define ArrayCopy(a,b,c,d,e) {for(int _idx=0;_idx<e;_idx++)c[d+_idx]=a[b+_idx];}
#endif // ARRC

#endif // _SPRITE_DEF_H_